// store/index.js  
import Vue from 'vue';
import Vuex from 'vuex';
import axios from 'axios'; // 直接导入 axios 

Vue.use(Vuex);



export default new Vuex.Store({
	state: {
		user: {},
		messages: [],
		socket: null,

	},
	mutations: {
		setUser(state, user) {
			// 修正了错误，使用 state.user 而不是 this.use  
			state.user = user;
		},
		setMessages(state, messages) {
			// 修正了错误，使用 state.user 而不是 this.use  
			state.messages = messages;
		},
		setSocket(state, socket) {
			// 修正了错误，使用 state.user 而不是 this.use  
			state.socket = socket;
		},


		//页面调用 this.$store.commit('setUUID', 'newUUIDValue');

	},
	// 异步函数
	actions: {


	},
	getters: {
		getUser: state => state.user,
		getMessages: state => state.messages,
		getSocket: state => state.socket,
		
		//页面调用 this.$store.getters.getUser;
	},




});